﻿using System;
#if SILVERLIGHT || NET40
using System.Threading;
#else
using System.Threading.Tasks;
#endif

namespace DaveSexton.Labs.Tests.Category1.Console
{
	public sealed class TimerLab : BaseConsoleLab
	{
		protected override void Main()
		{
			TraceTime();

#if SILVERLIGHT || NET40
			Thread.Sleep(TimeSpan.FromSeconds(1));
#else
			Task.Delay(TimeSpan.FromSeconds(1)).Wait();
#endif

			TraceTime("{0:hh\\ mm\\ ss\\.ffff}");

#if SILVERLIGHT || NET40
			Thread.Sleep(TimeSpan.FromSeconds(1));
#else
			Task.Delay(TimeSpan.FromSeconds(1)).Wait();
#endif

			TraceTime("{0} -> {1}", "Slept for two seconds total.");

			ResetTime();

#if SILVERLIGHT || NET40
			Thread.Sleep(TimeSpan.FromSeconds(1));
#else
			Task.Delay(TimeSpan.FromSeconds(1)).Wait();
#endif

			TraceTime();
		}
	}
}